﻿using RAP.Framework.Libary.DataSource.Model;
using RAP.Framework.Libary.DataSource.Model.Setter;
using System;
using System.Collections.Generic;

namespace RAP.Framework.Libary.DataSource.DataReader
{
  /// <summary>
  /// 
  /// </summary>
  public interface IDataModelParser
  {
    /// <summary>
    /// 
    /// </summary>
    /// <param name="typeName"></param>
    /// <returns></returns>
    IDataModel CreateDataModel(string typeName);

    /// <summary>
    /// 
    /// </summary>
    /// <param name="type"></param>
    /// <returns></returns>
    IDataModel CreateDataModel(Type type);

    /// <summary>
    /// 
    /// </summary>
    /// <param name="typeName"></param>
    /// <returns></returns>
    Type GetDataModelType(string typeName);

    /// <summary>
    /// 
    /// </summary>
    /// <param name="dataModel"></param>
    /// <param name="property"></param>
    /// <param name="value"></param>
    void SetPropertyValue(IDataModel dataModel, IDictionary<string, IPropertyValueSetter> setters, string property, object value);

    /// <summary>
    /// 
    /// </summary>
    /// <param name="dataModel"></param>
    /// <param name="property"></param>
    /// <param name="value"></param>
    void SetPropertyValue(IDataModel dataModel, string property, object value);

    /// <summary>
    /// 
    /// </summary>
    /// <param name="dataModelType"></param>
    /// <param name="property"></param>
    /// <param name="propertyType"></param>
    /// <returns></returns>
    IPropertyValueSetter CreatePropertyValueSetter(Type dataModelType, string property, Type propertyType);

    /// <summary>
    /// 
    /// </summary>
    /// <param name="dataModelType"></param>
    /// <returns></returns>
    IDictionary<string, IPropertyValueSetter> GetPropertyValueSetters(IDataModel dataModel);
  }
}
